/**
 * Created by Been on 2017-10-19.
 */
import jsonp from 'common/js/jsonp';
import axios from 'axios';
import {commonParams, options} from 'api/config';
// 获取banner图片
export function getRecommend () {
  const url = 'https://c.y.qq.com/musichall/fcgi-bin/fcg_yqqhomepagerecommend.fcg';
  let data = Object.assign({}, commonParams, {
    uin: 0,
    platform: 'h5',
    needNewCode: 1
  });
  return jsonp(url, data, options);
}
// 获取歌单
export function getSongsLists () {
  const url = '/api/getSongsLists';
  let data = Object.assign({}, commonParams, {
    picmid: 1,
    rnd: Math.random(),
    // jsonpCallback: 'getPlaylist',
    loginUin: 0,
    format: 'json',
    hostUin: 0,
    platform: 'yqq',
    needNewCode: 0,
    categoryId: 10000000,
    sortId: 5,
    sin: 0,
    ein: 29
  });
  return axios.get(url, {
    params: data
  }).then((res) => {
    return Promise.resolve(res.data);
  });
}

// 获取歌手
export function getSingers () {
  const url = 'https://c.y.qq.com/v8/fcg-bin/v8.fcg';
  let data = Object.assign({}, commonParams, {
    channel: 'singer',
    page: 'list',
    key: 'all_all_all',
    pagesize: 100,
    pagenum: 1,
    hostUin: 0,
    platform: 'yqq',
    needNewCode: 0
  });
  return jsonp(url, data, options);
}
